<template>
  <div style="background-color: darkcyan;width: calc(100%);height: 100px;">
    欢迎:{{userName}} 访问!
  </div>
  <div style="width: 200px;height: calc(100VH - 100px);float: left">
    <router-link to="/userlist">用户管理</router-link><br/>
    <router-link to="/config">系统管理</router-link><br/>
    <a href="javascript:void(0);" @click="logOut">退出</a>
  </div>
  <router-view></router-view>
</template>

<script>

import userList from "@/views/user/list";
import config from "@/views/system/config";

export default {
  name: "index",
  components:{
    userList,config
  },
  data(){
    return{
      userName:''
    }
  },
  methods:{
    logOut(){
      localStorage.removeItem('user')
      this.$router.push('/login')
    }
  },
  created() { //组件创建完成之后
    this.userName = localStorage.getItem('user')
  }
}
</script>

<style scoped>

</style>